#region File Description
//-----------------------------------------------------------------------------
// FireParticleSystem.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace Particle3DSample
{
    /// <summary>
    /// Custom particle system for creating a flame effect.
    /// </summary>
    class FireParticleSystem : ParticleSystem
    {
        public FireParticleSystem(Game game, ContentManager content)
            : base(game, content)
        { }


        protected override void InitializeSettings(ParticleSettings settings)
        {
            // specifies the asset to use for fire
            settings.TextureName = "fireTry";

            // maximum number of particles to displayed during circular loop
            // lower numbers make it look like bursts
            // might be useful
            settings.MaxParticles = 2400;

            settings.Duration = TimeSpan.FromSeconds(2);

            // Higher numbers for more disarray, stationery status
            settings.DurationRandomness = 1;

            // minimize these values for more direct thrust
            // maximize for stationary or "disarray"
            settings.MinHorizontalVelocity = -5;
            settings.MaxHorizontalVelocity = 5;

            // minimize these values for stationary or "disarray"
            // maximize for more direct thrust
            settings.MinVerticalVelocity = -5;
            settings.MaxVerticalVelocity = 5;

            // CHANGE this to the opposite of the facing vector for integration
            settings.Gravity = new Vector3(0, 0, 15);
            // settings.Gravity = -1*Ship.worldTransformMatrix.Forward

            settings.MinRotateSpeed = -2.9f;
            settings.MaxRotateSpeed = 2.9f;


            // play around with fourth value (alpha channel)
            // for varying degrees of transparency
            settings.MinColor = new Color(255, 255, 255, 10);
            settings.MaxColor = new Color(255, 255, 255, 20);

            settings.MinStartSize = 5;
            settings.MaxStartSize = 10;

            settings.MinEndSize = 10;
            settings.MaxEndSize = 40;

            // Use additive blending.
            settings.SourceBlend = Blend.SourceAlpha;
            settings.DestinationBlend = Blend.One;
        }
    }
}
